<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="offersForm">

		<h:panelGrid columns="2">
			<h:outputText value="Offer Name" />
			<h:inputText value="#{offersManagedBean.offerName }" />

		</h:panelGrid>
		<div style="height: 15px;" />
		<p:fileUpload fileUploadListener="#{offersManagedBean.handleFileUpload}"
			allowTypes="/(\.|\/)(gif|jpe?g|png)$/" description="Select Image"
			sizeLimit="20000" />
		<div style="height: 15px;" />
		<p:commandButton value="Save"
			oncomplete="if(#{!facesContext.validationFailed})
								popup.show();"
			action="#{offersManagedBean.saveOffer}" />
		<p:commandButton value="Update"
			oncomplete="if(#{!facesContext.validationFailed})
								popup.show();"
			action="#{offersManagedBean.update}" />
	</h:form>
	<p:dialog header="Message" widgetVar="popup" position="center">
		<h:outputLabel value="Offer aded successfully" />
	</p:dialog>
</ui:composition>